#include<stdio.h>
int book[100005]={1,1},b[100005],n,i,count=1,temp;
int main()
{
	scanf("%d",&n);getchar();
	for(i=2;i<=n;i++)
	{
		scanf("%d",&temp);
		b[ book[i]=book[temp]+1 ]++;
	}
	for(i=2;b[i]!=0;i++) count+=b[i]%2;
	printf("%d\n",count);
	return 0;
}
